//
//  SourceList.h
//  SourceView
//
//  Created by Keith Duncan on 04/05/2007.
//  Copyright 2007 thirty-three. All rights reserved.
//

#import <Cocoa/Cocoa.h>

extern NSString *KDContentImagesBinding;

@class ShadowTextCell, ImageTextCell;
@protocol SourceListDelegateProtocol, SourceListDatasourceProtocol;

/*!
    @class		 SourceView
    @abstract    An iLife '08 style source view
    @discussion  This is a bindings driven view (see below) that displays a hierarchy of data
*/

/*!
 
 Exposed Bindings:
 
 // Required Bindings, these provide the content
 
 • NSContentBinding, the arrangedObjects object of an NSTreeController or another compatable controller
 • KDContentImagesBinding, the key path by which the images are retrieved
 • NSContentValuesBinding, the key path by which the item titles are retrieved
 
 // Optional Bindings
 
 • KDSelectionIndexPathBinding, only a single index path is used, it's singular because a user shouldn't be able to select multiple row in a source view 
 • NSSelectedValueBinding, this is the selected item's title
 
 */

@interface SourceList : NSView {
	IBOutlet id <SourceListDelegateProtocol> delegate;
	IBOutlet id <SourceListDatasourceProtocol> datasource;
	
	NSMutableDictionary *_bindingInfo;
	
	ShadowTextCell *_titleCell;
	ImageTextCell *_contentsCell;
	
	CGFloat _rowHeight;
	CGFloat _nodeSeparation;
	
	NSMutableSet *_expanded, *_expandable, *_disclosureButtons;
	
	NSCountedSet *_disclosureLevels;
}

@end

@interface SourceList (Binding) <AFKeyValueBinding>

@end

@protocol SourceListDelegateProtocol <NSObject>
@optional
// Root children are NEVER selectable and you won't be queried
- (BOOL)sourceList:(SourceList *)view canSelectObject:(id)object;
@end

@protocol SourceListDatasourceProtocol <NSObject>
@optional
// You will only be asked about objects with children
// Root children default to NO like the 10.5 Finder
- (BOOL)sourceList:(SourceList *)view shouldDrawDisclosureForItem:(id)object;
@end
